
package flc.ast.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.ResumeBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class ModuleManageAdapter extends StkProviderMultiAdapter<ResumeBean.Module> {

    public ModuleManageAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(80));
        addItemProvider(new ModuleManageProvider());
    }

    private class ModuleManageProvider extends BaseItemProvider<ResumeBean.Module> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_module_manage;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, ResumeBean.Module bean) {
            baseViewHolder.setText(R.id.tvModuleManageItemName, bean.getAlias());
            if (baseViewHolder.getBindingAdapterPosition() == 0 || baseViewHolder.getBindingAdapterPosition() == 1) {
                baseViewHolder.setImageResource(R.id.ivModuleManageItemSel, R.drawable.aygx1);
            } else {
                if (bean.isShow()) {
                    baseViewHolder.setImageResource(R.id.ivModuleManageItemSel, R.drawable.aygx);
                } else {
                    baseViewHolder.setImageResource(R.id.ivModuleManageItemSel, R.drawable.awxz3);
                }
            }
        }
    }
}
